<?
include "header.php";
$P = new cMyPage;
$P->loadHeader();
$P->loadTitle("Search Page");
$locList = array();
$loc['url'] = '/search.php';
$loc['name'] = 'Search';
array_push($locList, $loc);
$P->loadLocation($locList);
$P->loadLinks();
$P->loadPreContent("Search Results");

if($P->isLoggedIn()) {

// Select users from database
$users = $db->sql_query("SELECT * FROM `users` WHERE name like '%".$_POST['searchFor']."%' ");

//Count number of users items
$users_total = $db->sql_affectedrows();
?>
<table >
<thead>
<tr>
<td>Username</td>
<td>Location</td>
<td>Current Employer</td>
</tr>
</thead>
<tbody> 
<?
//Loop each user row 
while ($row = $db->sql_fetchrow($users)){
?>

<tr>
<td><a href="userinfo.php?uid=<?=$row['id']; ?>">
<?=$row['name']; ?></a></td>
<td><?=$row['address']; ?></td>
<td><?=$row['e_name']; ?></td>




</td>
</tr>
<?
}
?>
</tbody>
</table>
      
<? //var_dump($user->data); ?>
<br /><br />
<? 
//Test RPI function
//if( $P->isRPI() ) echo "true"; else echo "false"; ?>
    
<? 

} // logged in if
else {

echo "Please log in.";
$P->displayLogin();
}

$P->loadPostContent(); $P->loadFooter(); ?>